package com.iskny.framework.model;

import java.io.Serializable;

import com.jfinal.kit.JsonKit;

public class UserBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 574973634592094319L;
	public static int FRONT = 1;
	public static int ADMIN = 2;
	private Long id;//用户id
	private String loginname;//登录名称
	private long type;//登录类型
	private long logintime;//记录登录时间
	public UserBean(long id,String loginname,long type){
		this.setId(id).setLoginname(loginname)
		.setType(type).setLogintime(System.currentTimeMillis());
	}
	public UserBean(User user){
		this.setLoginname(user.getStr("loginname"))
		.setType(user.getLong("type"))
		.setLogintime(System.currentTimeMillis());
	}
	public String getLoginname() {
		return loginname;
	}
	public UserBean setLoginname(String loginname) {
		this.loginname = loginname;
		return this;
	}
	public long getType() {
		return type;
	}
	public UserBean setType(long type) {
		this.type = type;
		return this;
	}
	public long getLogintime() {
		return logintime;
	}
	public UserBean setLogintime(long logintime) {
		this.logintime = logintime;
		return this;
	}
	
	public Long getId() {
		return id;
	}
	public UserBean setId(Long id) {
		this.id = id;
		return this;
	}
	@Override
	public String toString(){
		return JsonKit.toJson(this, 2);
	}
	
}
